<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Services\RoleService;
use Illuminate\Http\Request;

class RoleController extends Controller
{
    public function getRoleList(RoleService $roleService , Request $request)
    {
        $params = $request->input();
        $result = $roleService->getRoleList($params);
        return $this->responseSuccess($result);
    }

    public function roleList(RoleService $roleService , Request $request)
    {
        $params = $request->input();
        $result = $roleService->getList($params);
        return $this->responseSuccess( $result);
    }

    public function roleAdd(RoleService $roleService , Request $request)
    {
        $params = $request->input();
        $result = $roleService->addRole($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("添加失败，请重试！");
    }

    public function roleDel(RoleService $roleService , Request $request)
    {
        $params = $request->input();
        $result = $roleService->delRole($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("添加失败，请重试！");
    }
}
